import Vue from 'vue'
import App from './App.vue'

// 引入组件
import Book from './views/Book.vue'
import Find from './views/Find.vue'
import My from './views/My.vue'
import Part from './views/Part.vue'
import Rep from './views/Report.vue'
// 404
import NotFound from '@/views/NotFound'

Vue.config.productionTip = false
// 1.导入路由
import VueRouter from 'vue-router'
// 2.在vue中，使用使用vue的插件，都需要调用Vue.use()
Vue.use(VueRouter)
// 3.创建配置
const routes = [
  {
    //配置重定向
    path: '/',
    redirect: '/book'
  },
  {
    path: '/find/:journalism/:activity',
    component: Find
  },
  {
    path: '/my',
    component: My
  },
  {
    path: '/part',
    component: Part
  },
  {
    path: '/book',
    component: Book
  },
  {
    path: '/rep',
    component: Rep
  },
  {
    path: '*',
    component: NotFound
  }
]

const router = new VueRouter({
  routes
})
new Vue({
  render: (h) => h(App),
  router
}).$mount('#app')
